<template>
	<view class="index-section">
		<view class="title">
			<tit tit="品非遗" url="/pages/home/heritage"/>
		</view>
		<view class="main">
			<view class="item" v-for="(item,index) in list" :key="index" @tap.stop="handleDetail(item.id)">
				<view class="top1" >
					<image :src="$imageOss(item.image)" mode="widthFix" style="" class="image"></image>
					<view class="top">
						{{item.title}}
					</view>
					<view class="bot">
						<text class="bot1">申报地区：{{item.address}} </text>
					</view>
					<view class="bot">
						<view class="bot2"> {{item.createtime}}</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import tit from '@/pages/index/cpns/title.vue';
	import clickBtn from '@/pages/index/cpns/clickBtn.vue';
	import {
		heritageList
	} from "@/request/homeApi.js";
	
	export default {
		components: {
			tit,
			clickBtn,
		},
		data() {
			return {
				list: [],
				heritage_category_id:'',
				isText:''
			};
		},
		mounted() {
			this.getList()
		},
		methods:{
			handleDetail(id) {
				uni.navigateTo({
					url: `/pages/home/heritageDetails?id=${id}`,
				});
			},
			getList(){
				let that = this
				heritageList({
					heritage_category_id: that.heritage_category_id,
					page:1,
					limit:1,
					title:'',
					type:'',
					recommend:2
				}).then(res => {
					that.list = res.data.list
					res.data.count == 0 ? that.isText = '暂无内容' : that.isText = ''
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.index-section {
		.title{
			padding: 20rpx;
			margin-top: 20rpx;
			background-color: #fff;
		}
		.clickableInfo {
			margin: 20rpx 0;
		}

		.main {
			display: flex;
			flex-direction: column;
			.item {
				padding: 20rpx;
				margin-top: 20rpx;
				background-color: #fff;
				margin-top: 20rpx;
				.top1 {
					display: flex;
					flex-direction: column;

					.image {
						width: 100%;
						height: 300rpx !important;
						border-radius: 10rpx;
					}
					.top{
						color: #313131;
						font-family: PingFang SC;
						font-size: 30rpx;
						font-style: normal;
						font-weight: 400;
						line-height: normal;
						margin-top: 14rpx;
					}
					.bot {
						display: flex;
						flex-direction: row;
						justify-content: space-between;
						margin-top: 10rpx;
						overflow: hidden;
						  text-overflow: ellipsis;
						  white-space: nowrap;
						.bot1 {
							color: #909090;
							font-family: PingFang SC;
							font-size: 24rpx;
							font-style: normal;
							font-weight: 400;
							line-height: normal;
						}

						.bot2 {
							color: #909090;
							font-family: PingFang SC;
							font-size: 24rpx;
							font-style: normal;
							font-weight: 400;
							line-height: normal;
						}
					}
				}
			}
		}

	}
</style>